package lab02.Test13;

/**
 * Created by Administrator on 2017/10/24.
 */
public class Gymnastics extends ComputerAverage{
    @Override
    double average(double[] s) {
        for (int i=0;i<s.length-1;i++){
            for (int j=1;j<s.length-1;j++){
                if (s[i]>s [i+1]){
                    double t=s[i];
                    s[i]=s[i+1];
                    s[i+1]=t;
                }
            }
        }
        double a=0;
        for (int i=1;i<s.length-1;i++) {
            a = a + s[i];
        }
        a = a/(s.length-2);
        return a;
    }
}
